<?php use_helper('PA_Links') ?>
<?php if(isset($settings)): ?>
  <table id="settingsCategory">
    <tr>
    <th> Lp. </th>
    <th> Nazwa </th>
    <th> Admin</th>
    <th> Edycja </th>
    </tr>
  <?php if(count($settings) > 0): ?>
    <?php foreach($settings as $setting): ?>
      <tr>
        <td><p id="counter"></p></td>
        <td nowrap="nowrap"><?php echo $setting->getName() ?></td>
        <td><?php echo $setting->getAdminCategory() ? "TAK" : "NIE" ?></td>
        <td nowrap="nowrap">
          <?php if($sf_user->hasCredential('admin')): ?>
          <img src="/images/icons/change.png" class="middle" width="18" height="18"/>
          <a onclick="App.Table.attachForm(this, '<?php echo link_to_app('Core', 'homeGetForm', array('form' => 'SettingsCategoryForm', 'form_action' => 'update', 'id' => $setting->getId())) ?>', '#settingsCategory', 'updateSettingCategory', 2, 2, true)" class="middle">Zmień</a>
          <img src="/images/icons/delete.png" class="middle" width="16" height="16"/>
          <a href="<?php echo link_to_app('Core', 'deleteSettingCategory', array('id' => $setting->getId())) ?>" class="middle">Usuń</a>
          <?php endif; ?>
        </td>
      </tr>
    <?php endforeach; ?>
      <tr id="add">
        <td colspan="6">
          <img src="/images/icons/add.png" class="middle" width="16" height="16" />  
          <a onclick="App.Table.attachForm(this, '<?php echo link_to_app('Core', 'homeGetForm', array('form' => 'SettingsCategoryForm', 'form_action' => 'create')) ?>', '#settingsCategory', 'createSettingCategory', 2, 2, true)" class="middle">Dodaj</a>
        </td>
      </tr>
  <?php else: ?>
  <tr>
      <td colspan="6"> Brak ustawień. </td>
  </tr>
  <tr id="add">
    <td colspan="6">
      <img src="/images/icons/add.png" class="middle" width="16" height="16" />  
      <a onclick="App.Table.attachForm(this, '<?php echo link_to_app('Core', 'homeGetForm', array('form' => 'SettingsCategoryForm', 'form_action' => 'create')) ?>', '#settingsCategory', 'createSettingCategory', 2, 2, true)" class="middle">Dodaj</a>
    </td>
  </tr>
  <?php endif; ?>
  </table>
<?php endif; ?>
